page — produce a hypertext link
Attribute | Pos. | Req. | Default | Description |
---|---|---|---|---|
Standard options |
See options for tag [area] .
|
|||
extra | None. |
Name of a CSS class to insert as class= .
|
||
interpolate | 0 | interpolate output? | ||
hide | 0 | Hide the tag return value? |
The [page]
tag expands to a proper hypertext URL link which
preserves Interchange session information and arguments passed onto
the targeted page or form action. The target page argument you
supply is treated relatively
to the pages/
directory inside your
catalog root directory (CATROOT).
The enclosing <a href=""></a> HTML tag is included. Where
this is unwanted, use [area]
.
Besides just producing hypertext links to specific pages, you can also "embed" complete HTML forms in the target link (for say, one-click ordering or searches); see the section called “EXAMPLES”.
Example: Produce the basic hypertext link
Add the following to an Interchange page:
Please visit our [page index]Welcome</a> page.
Example: Pass arguments onto the target page
Add the following link to an Interchange page:
Visit the [page href='test' arg='arg1=value1/arg2=value2']test</a> page.
The relevant part of your test.html
page could then
look like this:
<p>This is a test page.</p> [if session arg] <p>You have passed an argument onto this page:</p> <p>[data session arg]</p> [else] You did not pass any arguments to this page. [/else] [/if] <p>Have a nice day!</p>
Example: Embedding HTML forms in the page tag
[page form=" mv_order_item=99-102 mv_order_size=L mv_order_quantity=1 mv_separate_items=1 mv_todo=refresh" ]Order T-shirt in Large size</a>
Or another example:
[page form=" mv_todo=refresh mv_order_item=000101 mv_order_fly=description=An on-the-fly item|price=100.01 "]Order item 000101</a>
Which is equivalent to the usual HTML form:
<form action="[area process]" method="post"> <input type='hidden' name='mv_todo' value="refresh"> <input type='hidden' name='mv_order_item' value="000101"> Qty: <input size='2' name='mv_order_quantity' value="1"> <input type='hidden' name='mv_order_fly' value="description=An on-the-fly item|price=100.00"> <input type='submit' value="Order button"> </form>
Example: Implementing searches using href=/arg= options
[page scan se=Impressionists sf=category] Search for Impressionist Paintings</a>
Or the equivalent, using named parameters and more understandable quoting:
[page href=scan arg="se=Impressionists sf=category"] Search for Impressionist Paintings</a>
If the arg
parameter is set, it will be available
within the search display page as [value mv_arg]
.
Example: Implementing searches using search= option
The search attribute is a shorthand for the
href / arg scheme.
When search is used,
href will be set to scan
and
arg to the value of
search .
[page search=" se=Impressionists sf=category"] Search for Impressionist Paintings</a>
The [page]
tag examples use some advanced argument-quoting concepts.
To minimize confusion, please see the proper and complete quoting explanation
in the ITL glossary entry.
Since the [page]
already includes an opening HTML link
(the "<a href=
"
part), the only thing left is to close it using "...
></a>
"
after typing in the link text. There is a [/page]
macro
in existence, but it translates directly to </a>
— which means typing </a>
directly
saves parser a little work. The use of this macro is discouraged
and you should always insert "</a>
" directly.
Interchange 5.9.0:
Source: code/SystemTag/page.coretag
Lines: 16
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: page.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $ UserTag page Order href arg UserTag page addAttr UserTag page attrAlias base arg UserTag page Implicit secure secure UserTag page PosNumber 2 UserTag page version $Revision: 1.4 $ UserTag page MapRoutine Vend::Interpolate::tag_page
Source: lib/Vend/Interpolate.pm
Lines: 2685
sub tag_page { my ($page, $arg, $opt) = @_; my $url = tag_area(@_); my $extra; if($extra = ($opt ||= {})->{extra} || '') { $extra =~ s/^(\w+)$/class=$1/; $extra = " $extra"; } return qq{<a href="$url"$extra>}; }
Source: lib/Vend/Interpolate.pm
Lines: 2685
sub tag_page { my ($page, $arg, $opt) = @_; my $url = tag_area(@_); my $extra; if($extra = ($opt ||= {})->{extra} || '') { $extra =~ s/^(\w+)$/class=$1/; $extra = " $extra"; } return qq{<a href="$url"$extra>}; }